<?php
/**
 * @package    Joomla.Tutorials
 * @subpackage Components
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1
 * @license    GNU/GPL
*/
 
// no direct access
// ajouter le tank dans la base de donner des replays 
 
defined( '_JEXEC' ) or die( 'Restricted access' );
 
jimport( 'joomla.application.component.view');
jimport( 'joomla.filesystem.path' );

jimport( 'joomla.database.database' );
 
/**
 * HTML View class for the HelloWorld Component
 *
 * @package    HelloWorld
 */
 
class wotclanViewragot extends JView
{
    function display($tpl = null)
    {
    	include JPATH_COMPONENT.DS.'functions.php';
	$document	= JFactory::getDocument();
//	JHTML::_('stylesheet', 'style.css', 'components/com_icagenda/add/css/');
	$document->addStyleSheet( JURI::base().'components/com_wotclan/css/style.css' );
    	$cuser =& JFactory::getUser();
    	$cusr_id = $cuser->get('id');
      $db =& JFactory::getDbo();
      $greeting = "Les ragots!";
      $this->assignRef( 'greeting', $greeting );
      parent::display($tpl);
      $query = $db->getQuery(true);

      $query="SELECT * FROM `#__wotclan_ragots`  ORDER BY date DESC LIMIT 0,100";
     //echo $query;
      $db->setQuery($query);
      $db->query();
      $num_rows = $db->getNumRows();
      $rows = $db->loadObjectList();
      echo "<div align='center'>";
      
      echo "<table>";
 
      foreach ( $rows as $row ) {
      	
	echo "<tr><td name='ragot' >";
		echo ' ',preg_replace('/([0-9].*\-[0-9].*\-[0-9].*) [0-9].*\:[0-9].*\:[0-9].*/', '$1', $row->date),' : ',$row->text;
	echo "</td></tr>";
		    
		}	
		echo "</table></div>";
    
    }
}



